{include file="public/head"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">全局设置</div>
                <div class="layui-card-body">
                    <div class="layui-tab">
                        <ul class="layui-tab-title">
                            <!--
                            <li class="layui-this">返现设置</li>

                            -->
                            <li class="layui-this">客服信息</li>
                            <li>红包设置</li>
                        </ul>
                        <div class="layui-tab-content">
                            <!--

                            <div class="layui-tab-item">
                                <div class="layui-form" wid100 lay-filter="form">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">银行名称</label>
                                        <div class="layui-input-inline">
                                            <input name="bank_name" lay-verify="required" id="bank_name"
                                                   placeholder="账户银行名称" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">账户名称</label>
                                        <div class="layui-input-inline">
                                            <input name="bank_username" lay-verify="required" id="bank_username"
                                                   placeholder="账户名称" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">银行卡号</label>
                                        <div class="layui-input-inline">
                                            <input name="bank_number" lay-verify="required" id="bank_number"
                                                   placeholder="银行卡号" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">微信二维码</label>
                                        <div class="layui-input-inline">
                                            <input name="wechat_qr" id="wechat_qr" value=""
                                                   placeholder="图片地址" class="layui-input">
                                        </div>
                                        <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                            <button type="button" class="layui-btn" id="wechatUpload">
                                                <i class="layui-icon">&#xe67c;</i>上传图片
                                            </button>
                                            <button class="layui-btn layui-btn-primary" layadmin-event="wechatShow">查看图片
                                            </button>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">支付宝二维码</label>
                                        <div class="layui-input-inline">
                                            <input name="alipay_qr" id="alipay_qr" value=""
                                                   placeholder="图片地址" class="layui-input">
                                        </div>
                                        <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                            <button type="button" class="layui-btn" id="alipayUpload">
                                                <i class="layui-icon">&#xe67c;</i>上传图片
                                            </button>
                                            <button class="layui-btn layui-btn-primary" layadmin-event="alipayShow">查看图片
                                            </button>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <label class="layui-form-label">银行支付</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="bank_status" value="1" title="开启">
                                            <input type="radio" name="bank_status" value="2" title="关闭">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">微信支付</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="wx_status" value="1" title="开启">
                                            <input type="radio" name="wx_status" value="2" title="关闭">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">支付宝支付</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="zfb_status" value="1" title="开启">
                                            <input type="radio" name="zfb_status" value="2" title="关闭">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit lay-filter="set_website_seo">确认保存
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            -->
                            <div class="layui-tab-item layui-show">
                                <div class="layui-form" wid100 lay-filter="form">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">是否开启话题</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="ht_status" value="1" title="开启">
                                            <input type="radio" name="ht_status" value="2" title="关闭">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">是否虚拟登录</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="false_login" value="1" title="开启">
                                            <input type="radio" name="false_login" value="2" title="关闭">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">竞猜答题奖励</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="reward" lay-verify="required" id="reward"
                                                   placeholder="竞猜答题奖励:元" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">竞猜答题奖励</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="reward" lay-verify="required" id="reward"
                                                   placeholder="竞猜答题奖励:元" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">客户电话</label>
                                        <div class="layui-input-inline">
                                            <input name="tel_number" lay-verify="required" id="tel_number"
                                                   placeholder="客服电话" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">二维码</label>
                                        <div class="layui-input-inline">
                                            <input name="kefu_qr" id="kefu_qr" value=""
                                                   placeholder="图片地址" class="layui-input">
                                        </div>
                                        <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                            <button type="button" class="layui-btn" id="kefuUpload">
                                                <i class="layui-icon">&#xe67c;</i>上传图片
                                            </button>
                                            <button class="layui-btn layui-btn-primary" layadmin-event="kefuShow">查看图片
                                            </button>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit lay-filter="set_website_image">确认保存
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-tab-item">
                                <div class="layui-form" wid100 lay-filter="form">
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">观看时长</label>
                                            <div class="layui-input-inline">
                                                <input type="number" name="watch_time" lay-verify="required"
                                                       laceholder="分钟" autocomplete="off" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">观看多少分钟，即可获取红包</div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">红包金额</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="money" lay-verify="required" id="self_money"
                                                   placeholder="单个红包金额" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">单个红包金额</div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">红包数量</label>
                                        <div class="layui-input-inline">
                                            <input type="number" name="number" lay-verify="required" id="team_money"
                                                   placeholder="红包数量" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">一共发多少个红包</div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">红包关闭</label>
                                        <div class="layui-input-block">
                                            <input type="radio" name="site_status" value="1" title="开启">
                                            <input type="radio" name="site_status" value="2" title="关闭">
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" lay-submit lay-filter="set_website">确认保存</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/foot"/}
<script>
    layui.config({
        base: '__LAYDMIN__', {if config('app.app_debug')}version: true{/if}
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'colorpicker', 'upload'], function () {

        var $ = layui.$
            , layer = layui.layer
            , laytpl = layui.laytpl
            , setter = layui.setter
            , view = layui.view
            , admin = layui.admin
            , form = layui.form
            , upload = layui.upload, colorpicker = layui.colorpicker;

        form.val("form", {$info|raw})
        var color = $('.color').val();
        colorpicker.render({
            elem: '#color'
            , color: color //设置默认色
            , done: function (color) {
                $('.color').val(color);
            }
        });
        $('#password').val('');

        var $body = $('body');
        //上传logo
        var logo = $('#logo');
        upload.render({
            url: '{:url(SYS_PATH."/uploads/upimg")}'
            , elem: '#logoUpload'
            , done: function (res) {
                if (res.code == 0) {
                    logo.val(res.url);
                    //logo.parent().append('<input type="hidden" name="logo_aid" value="'+res.aid+'">')
                } else {
                    layer.msg(res.msg, {icon: 5});
                }
            }
        });
        //查看logo
        admin.events.logoShow = function (othis) {
            var src = logo.val();
            layer.photos({
                photos: {
                    "title": "查看图片" //相册标题
                    , "data": [{
                        "src": src //原图地址
                    }]
                }
                , shade: 0.01
                , closeBtn: 1
                , anim: 5
            });
        };

        //上传水印图片
        var markImg = $('#markImg');
        upload.render({
            url: '{:url(SYS_PATH."/uploads/upimg")}'
            , elem: '#markImgUpload'
            , done: function (res) {
                if (res.code == 0) {
                    markImg.val(res.url);
                } else {
                    layer.msg(res.msg, {icon: 5});
                }
            }
        });
        //查看logo
        admin.events.markImgShow = function (othis) {
            var src = markImg.val();
            layer.photos({
                photos: {
                    "title": "查看图片" //相册标题
                    , "data": [{
                        "src": src //原图地址
                    }]
                }
                , shade: 0.01
                , closeBtn: 1
                , anim: 5
            });
        };
        //基础设置
        form.on('submit(set_website)', function (obj) {
            admin.req({
                url: '{:url(SYS_PATH."/".CONTROLLER."/globalConfig")}'
                , data: obj.field
                , type: 'post'
                , success: function (res) {
                    if (res.code == 0) {
                        window.top.layer.msg(res.msg, {icon: 1, time: 1000,shade:[0.5,'#000']});
                    } else {
                        window.top.layer.msg(res.msg, {icon: 2, time: 1000,shade:[0.5,'#000']});
                    }
                }
            });
            return false;
        });

        //SEO配置
        form.on('submit(set_website_seo)', function (obj) {
            admin.req({
                url: '{:url(SYS_PATH."/".CONTROLLER."/globalConfig?type=SITE_SEO")}'
                , data: obj.field
                , type: 'post'
                , success: function (res) {
                    if (res.code == 0) {
                        window.top.layer.msg(res.msg, {icon: 1, time: 1000,shade:[0.5,'#000']});
                    } else {
                        window.top.layer.msg(res.msg, {icon: 2, time: 1000,shade:[0.5,'#000']});
                    }
                }
            });
            return false;
        });

        //图片上传配置
        form.on('submit(set_website_image)', function (obj) {
            admin.req({
                url: '{:url(SYS_PATH."/".CONTROLLER."/globalConfig?type=UPLOAD_IMG")}'
                , data: obj.field
                , type: 'post'
                , success: function (res) {
                    if (res.code == 0) {
                        window.top.layer.msg(res.msg, {icon: 1, time: 1000,shade:[0.5,'#000']});
                    } else {
                        window.top.layer.msg(res.msg, {icon: 2, time: 1000,shade:[0.5,'#000']});
                    }
                }
            });
            return false;
        });

        //上传微信二维码
        var thumb = $('#wechat_qr');
        upload.render({
            url: '{:url(SYS_PATH."/uploads/upimg")}'
            , elem: '#wechatUpload'
            , done: function (res) {
                if (res.code == 0) {
                    thumb.val(res.url);
                    //logo.parent().append('<input type="hidden" name="logo_aid" value="'+res.aid+'">')
                } else {
                    layer.msg(res.msg, {icon: 5});
                }
            }
        });
        //查看微信二维码
        admin.events.wechatShow = function (othis) {
            var src = thumb.val();
            layer.photos({
                photos: {
                    "title": "查看图片" //相册标题
                    , "data": [{
                        "src": src //原图地址
                    }]
                }
                , shade: 0.01
                , closeBtn: 1
                , anim: 5
            });
        };

        //上传支付宝二维码
        var ali_thumb = $('#alipay_qr');
        upload.render({
            url: '{:url(SYS_PATH."/uploads/upimg")}'
            , elem: '#alipayUpload'
            , done: function (res) {
                if (res.code == 0) {
                    ali_thumb.val(res.url);
                    //logo.parent().append('<input type="hidden" name="logo_aid" value="'+res.aid+'">')
                } else {
                    layer.msg(res.msg, {icon: 5});
                }
            }
        });
        //查看支付宝二维码
        admin.events.alipayShow = function (othis) {
            var src = ali_thumb.val();
            layer.photos({
                photos: {
                    "title": "查看图片" //相册标题
                    , "data": [{
                        "src": src //原图地址
                    }]
                }
                , shade: 0.01
                , closeBtn: 1
                , anim: 5
            });
        };

        //上传客服二维码
        var kf_thumb = $('#kefu_qr');
        upload.render({
            url: '{:url(SYS_PATH."/uploads/upimg")}'
            , elem: '#kefuUpload'
            , done: function (res) {
                if (res.code == 0) {
                    kf_thumb.val(res.url);
                    //logo.parent().append('<input type="hidden" name="logo_aid" value="'+res.aid+'">')
                } else {
                    layer.msg(res.msg, {icon: 5});
                }
            }
        });
        //查看客服二维码
        admin.events.kefuShow = function (othis) {
            var src = kf_thumb.val();
            layer.photos({
                photos: {
                    "title": "查看图片" //相册标题
                    , "data": [{
                        "src": src //原图地址
                    }]
                }
                , shade: 0.01
                , closeBtn: 1
                , anim: 5
            });
        };



        //上传客服二维码
        var kf_thumb1 = $('#kefu_qr1');
        upload.render({
            url: '{:url(SYS_PATH."/uploads/upimg")}'
            , elem: '#kefuUpload1'
            , done: function (res) {
                if (res.code == 0) {
                    kf_thumb1.val(res.url);
                    //logo.parent().append('<input type="hidden" name="logo_aid" value="'+res.aid+'">')
                } else {
                    layer.msg(res.msg, {icon: 5});
                }
            }
        });
        //查看客服二维码
        admin.events.kefuShow1 = function (othis) {
            var src = kf_thumb1.val();
            layer.photos({
                photos: {
                    "title": "查看图片" //相册标题
                    , "data": [{
                        "src": src //原图地址
                    }]
                }
                , shade: 0.01
                , closeBtn: 1
                , anim: 5
            });
        };
    })
</script>
</body>
</html>